package com.zhu.esyblog.controller;


import com.zhu.esyblog.pojo.RespBean;
import com.zhu.esyblog.service.ICategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author stx
 * @since 2022-06-22
 */
@RestController
@RequestMapping("/categorys")
@Api(tags = "文章分类模块")
public class CategoryController {
    @Autowired
    private ICategoryService categoryService;

        @GetMapping
        @ApiOperation(value = "获取所有文章分类")
        public RespBean categories(){
            return categoryService.findAll();
        }
    @GetMapping("/detail")
    @ApiOperation(value = "获取所有文章分类detail")
    public RespBean categoriesDetail(){
        return categoryService.categoriesDetail();
    }

    @GetMapping("/detail/{id}")
    @ApiOperation(value = "获取所有文章分类detail")
    public RespBean categoriesDetailById(@PathVariable("id")Long id){

        return categoryService.categoriesDetailById(id);
    }
}
